//
//  ViewController.m
//  明和智能
//
//  Created by innofive on 2018/4/12.
//  Copyright © 2018年 inno. All rights reserved.
//

#import "ViewController.h"
#import "MainTableViewController.h"
#import "MeTableViewController.h"
#import "CarTableViewController.h"
@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
   
    MainTableViewController *vc = [[MainTableViewController alloc]initWithStyle:(UITableViewStyleGrouped)];
    UINavigationController *nac1 = [self onCrearchVC:vc Title:@"首页" Image:@"c_zhuye_icon" SelImage:@"c_zhuye_hover_icon"];

    CarPageViewController *vc2 = [[CarPageViewController alloc]init];
    UINavigationController *nac3 = [self onCrearchVC:vc2 Title:@"找车位" Image:@"c_tcchang_icon" SelImage:@"c_tcchang_hover_icon"];
    
    MeTableViewController *vc1 = [[MeTableViewController alloc]initWithStyle:(UITableViewStyleGrouped)];
    UINavigationController *nac2 = [self onCrearchVC:vc1 Title:@"我的" Image:@"c_wode_icon" SelImage:@"c_wode_hover_icon"];
    self.viewControllers = @[nac1,nac3,nac2];

}

-(UINavigationController *)onCrearchVC:(UIViewController *)vc Title:(NSString *)title Image:(NSString *)image SelImage:(NSString *)selImage
{
    
    UINavigationController *nac1 = [[UINavigationController alloc]initWithRootViewController:vc];
    nac1.tabBarItem.title = title;
    nac1.tabBarItem.image = [[UIImage imageNamed:image] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    nac1.tabBarItem.selectedImage = [[UIImage imageNamed:selImage] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    [nac1.tabBarItem setTitleTextAttributes:@{NSForegroundColorAttributeName: hexCOLOR(@"FD8F25")} forState:UIControlStateSelected];
    [nac1.tabBarItem setTitleTextAttributes:@{NSForegroundColorAttributeName: hexCOLOR(@"CCCCCC")} forState:UIControlStateNormal];
    
    return nac1;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
